//
//  inPutViewController.m
//  FSH5Pay
//
//  Created by 四维图新科技股份有限公司 on 2022/8/18.
//

#import "InputViewController.h"
#import "ViewController.h"
#import "WXPay/WXApiObject.h"
#import "WXPay/WXApi.h"

@interface inPutViewController ()
@property (nonatomic ,strong)UITextView *urlText;
@property (nonatomic ,strong)UITextView *tokenText;
@property (nonatomic ,strong)UIButton *btn;
@property (nonatomic ,strong)UIButton *btn1;
@end

@implementation inPutViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"请输入";
    [self.view addSubview:self.urlText];
    [self.view addSubview:self.tokenText];
    [self.view addSubview:self.btn];
    [self.view addSubview:self.btn1];
    self.view.backgroundColor = [UIColor whiteColor];
}

- (UITextView *)urlText{
    if (!_urlText) {
        _urlText = [[UITextView alloc]initWithFrame:CGRectMake(50, 100+30, self.view.frame.size.width-100, 100)];
        _urlText.backgroundColor = [UIColor lightGrayColor];
        ///开通免密的测试链接
        _urlText.text = @"http://172.24.2.110:3333/niutron/spa";
//        _urlText.text = @"https://render.alipay.com/p/c/mdeduct-landing?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D20000067%26url%3Dhttps%253A%252F%252Fopenapi.alipay.com%252Fgateway.do%253Falipay_sdk%253Dalipay-sdk-java-dynamicVersionNo%2526app_id%253D2018112262335038%2526biz_content%253D%25257B%252522agreement_sign_params%252522%25253A%25257B%252522external_agreement_no%252522%25253A%2525227454671230331112V4F1UQFF3CL%252522%25252C%252522personal_product_code%252522%25253A%252522GENERAL_WITHHOLDING_P%252522%25252C%252522sign_scene%252522%25253A%252522INDUSTRY%25257CCARRENTA%252522%25257D%25252C%252522body%252522%25253A%252522Test111%252522%25252C%252522integration_type%252522%25253A%252522ALIAPP%252522%25252C%252522out_trade_no%252522%25253A%2525227454671230331112V4F1UQFF3CL%252522%25252C%252522product_code%252522%25253A%252522GENERAL_WITHHOLDING%252522%25252C%252522subject%252522%25253A%252522Test1111%252522%25252C%252522total_amount%252522%25253A%2525220.01%252522%25257D%2526charset%253DUTF8%2526format%253Djson%2526method%253Dalipay.trade.page.pay%2526sign%253DziWf4jhBi5%25252FdcVvwajYv5h9WTK4D3VcHkF%25252Bs6TnDEDpcVwgrb%25252F%25252Fbqh4Dwe4%25252F75kqeZdcqVMw05gH2F8A7WwnR%25252BqLU6YCjIAo8mJzlmnlB%25252Fe%25252Fl9R3GwiykIFy6f0au1YiNNx7WsodhzZJWXOAHKeDVKaBrBr%25252F9u%25252F%25252B45n%25252BJGs4Oiz7Md0kcQckI4DN16UWXhI29Txlx56ExAvi347iOwikq0%25252BsriedpTy72w94ua9qXppvtyYIlqc8td1%25252Fp%25252FjPS%25252B3DOfJKUla4wzsD3SC0BGP1y12PiY7jNslkULQyyBzHeO0wkuv%25252B7tCVkqA4p%25252B11j4zC1pB11Nz3bYKRWT1f91tGOQ%25253D%25253D%2526sign_type%253DRSA2%2526timestamp%253D2022-08-11%252B15%25253A44%25253A28%2526version%253D1.0";
//        _urlText.text = @"https://render.alipay.com/p/c/mdeduct-landing?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D20000067%26url%3Dhttps%253A%252F%252Fopenapi.alipay.com%252Fgateway.do%253Falipay_sdk%253Dalipay-sdk-java-dynamicVersionNo%2526app_id%253D2018112262335038%2526biz_content%253D%25257B%252522agreement_sign_params%252522%25253A%25257B%252522external_agreement_no%252522%25253A%2525227454671230331112V4F1UQFF301%252522%25252C%252522personal_product_code%252522%25253A%252522GENERAL_WITHHOLDING_P%252522%25252C%252522sign_scene%252522%25253A%252522INDUSTRY%25257CCARRENTA%252522%25257D%25252C%252522body%252522%25253A%252522Test111%252522%25252C%252522integration_type%252522%25253A%252522ALIAPP%252522%25252C%252522out_trade_no%252522%25253A%2525227454671230331112V4F1UQFF301%252522%25252C%252522product_code%252522%25253A%252522GENERAL_WITHHOLDING%252522%25252C%252522subject%252522%25253A%252522Test1111%252522%25252C%252522total_amount%252522%25253A%2525220.01%252522%25257D%2526charset%253DUTF8%2526format%253Djson%2526method%253Dalipay.trade.page.pay%2526sign%253De8GJSM%25252F5YCBKWaGvcSOTkTvf1sppr2wDnP1FarY53iDVG4tg%25252FHmbw1R52bv%25252BNdio%25252BuTBPoYWBgsbXxzm0mCW4TZfYkWxppMh%25252F0QcnNVeeZrWSpgdt3v5v9MfcfcumxEx6x%25252B5ddmqF4uLetNJNW1uMyx2vImAcrvXa%25252FjhB8mo7PaZ7wzYYto0O8ILpdg4nJdwsl1mYw7zGMzmnUJWRvEkY5Rk1u8rLH%25252FYCKNqL8Dbs36hk%25252FfYYUE9fuvEPkUjdkoodZv%25252BpHhqGbyUDRZaVee2uDlGR87rJLKpKTgJwo9L%25252BwcLqanrLKO09NYpNo53iz33sjTNIBw87HwD%25252FoOzbLpWMQ%25253D%25253D%2526sign_type%253DRSA2%2526timestamp%253D2022-08-11%252B15%25253A53%25253A08%2526version%253D1.0";
    
    }
    return _urlText;
}

- (UITextView *)tokenText{
    if (!_tokenText) {
        _tokenText = [[UITextView alloc]initWithFrame:CGRectMake(50, 100 + 100+50, self.view.frame.size.width-100, 100)];
        _tokenText.backgroundColor = [UIColor lightGrayColor];
        _tokenText.text = @"D9Mw0LZze29sxgaDsadmPoW0wEI8ljYUaY8OSRPNCoxH6lSC8qyU7a4gEgS5qEcwWffijttz7SjFHdQb6KdQubxhCuIHI3AyNRq2CzjEClRyq+fF6XkFOPDUzs8FTYN+AW1oZf7ugoUjHwN/3GsigQ==";
    }
    return _tokenText;
}

- (UIButton *)btn{
    if (!_btn) {
        _btn = [[UIButton alloc]initWithFrame:CGRectMake(50, 500, self.view.frame.size.width-100, 50)];
        _btn.backgroundColor = [UIColor blueColor];
        [_btn setTitle:@"提交" forState:UIControlStateNormal];
        [_btn addTarget:self action:@selector(tj) forControlEvents:UIControlEventTouchUpInside];
    }
    return _btn;
}
- (UIButton *)btn1{
    if (!_btn1) {
        _btn1 = [[UIButton alloc]initWithFrame:CGRectMake(50, 600, self.view.frame.size.width-100, 50)];
        _btn1.backgroundColor = [UIColor blueColor];
        [_btn1 setTitle:@"一键清空" forState:UIControlStateNormal];
        [_btn1 addTarget:self action:@selector(clear) forControlEvents:UIControlEventTouchUpInside];
    }
    return _btn1;
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.view endEditing:YES];
}
- (void)tj{
//    ViewController *vc = [[ViewController alloc]init];
//    vc.url = self.urlText.text;
//
//    vc.token = self.tokenText.text;
//    [self.navigationController pushViewController:vc animated:YES];
    
    WXLaunchMiniProgramReq *req = [WXLaunchMiniProgramReq object];
    ///小程序的原始ID
    req.userName = @"gh_f8013eafae05";
//    req.userName = @"gh_f33b2bcaed5d";
    ///小程序路径
    req.path = @"pages/start/start?appId=xxx";
//    req.path = @"https://www.taolvzhi.com/pages/storedetails/storeDetails?user_id=";
    ///小程序类型
    req.miniProgramType = WXMiniProgramTypeRelease;
    ///API拉起
    [WXApi sendReq:req completion:^(BOOL success) {

    }];
}
- (void)clear{
    self.urlText.text = @"";
}
@end
